﻿using Microsoft.WindowsAzure.Storage.Table;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Metadata.Edm;
using System.Globalization;
using System.Linq;
using System.Web;
using Webservice.Models;

namespace Webservice.Entities
{
    public class MomentEntity : TableEntity
    {
        public int Entry { get; set; }
        public string Recorded { get; set; }
        public double Heading { get; set; }
        public double Latitude { get; set; }
        public double Longitude { get; set; }
        public string GPSFix { get; set; }
        public double Fuel { get; set; }
        public double Speed { get; set; }
        public double Throttle { get; set; }
        public double XAxis { get; set; }
        public double YAxis { get; set; }
        public double ZAxis { get; set; }
        public string VIN { get; set; }

        public MomentEntity()
        {
            
        }

        public MomentEntity(string uniqueId, int row, MomentModel model)
        {
            this.Entry = row;
            this.Recorded = model.Recorded.Replace(" zzz", "");
            this.Fuel = model.Fuel;
            this.Heading = model.Heading;
            this.Latitude = model.Latitude;
            this.Longitude = model.Longitude;
            this.GPSFix = model.GPSFix.Replace(" zzz", "");
            this.Speed = model.Speed;
            this.Throttle = model.Throttle;
            this.VIN = model.VIN;
            this.XAxis = model.XAcceleration;
            this.YAxis = model.YAcceleration;
            this.ZAxis = model.ZAcceleration;

            this.PartitionKey = uniqueId;
            this.RowKey = row.ToString();
        }
    }
}